﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using NewsAggregatorLibrary;

namespace NewsAggregator
{
    public partial class getKeywords : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        public static string CreateJSON()
        {
            KeywordsMemberCollection keywords = KeywordsMember.RetrieveAll();

            string feed = "var keywords = [\n";

            feed = keywords.Aggregate(feed, (current, keyword) => current + ("\"" + keyword.Keyword + "\",\n"));

            feed += " ];\n";
           
            return feed;

        }
    }
}